package convert;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ArrayToListDemo {

    public static void main(String[] args) {
        String[] citys = {"北京","上海","广州","深圳"};
        List<String> list = Arrays.asList(citys);
        List<String> newList = new ArrayList<String>(Arrays.asList(citys));
        list.forEach(System.out::println);
        System.out.println("---------------newList不是只读的-------------------");
        newList.add("西安");
        newList.forEach(System.out::println);
        System.out.println("---------------Arrays.asList转换后的集合只读-------------------");
        list.add("西安");
        list.forEach(System.out::println);
    }
}
